<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
<head>
	<title>按药品审核药品资质</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">

    <section class="content-header">
        <h1>按药品审核药品资质</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">采购项目管理</a></li>
            <li class="active"><a href="#">按药品审核药品资质</a></li>
        </ol>
    </section>
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class=" form-inline">
                    <div class="form-group form-group-xs">
                     <label>药品编号：</label>
                        <input class="form-control" type="text" id="drugCode" placeholder="药品编码" />
                    </div>
                     <div class="form-group form-group-xs">
                        <label>药品名：</label>
                        <input class="form-control" type="text" id="qualityspecName" placeholder="药品名" />
                    </div>
                    <div class="form-group form-group-xs">
                        <label>企业名：</label>
                        <input class="form-control" type="text" id="compName" placeholder="企业名" />
                    </div>
                    <button type="button" class="btn btn-success btn-sm" onclick="search()">查询</button>
                </div>
            </div>
        </div>
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        <div class=" box box-warning bottongroup">
        	<label class="btn btn-default btn-sm" onclick="batchChangeStatus()">审核通过</label>
        	<label class="btn btn-default btn-sm" onclick="batchChangeStatusNot()">审核不通过</label>
        	<label class="btn btn-default btn-sm" onclick="batchChangeStatusAudit()">澄清通过</label>
        	<label class="btn btn-default btn-sm" onclick="batchChangeStatusAuditNot()">澄清不通过</label>
           <a href="toAuditCompprofileProjList.html?projId=${param.projId}" class="btn btn-default btn-sm" >返回</a>
        </div>
        
    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
    
    //查询
	function search() {
		var drugCode = $("#drugCode").val();
		var qualityspecName = $("#qualityspecName").val();
		var compName = $("#compName").val();
		$("#gridlist").jqGrid("clearGridData");
			$("#gridlist").jqGrid('setGridParam',{  
			url:"${ctx}/bidProject/getAuditDrugCompprofileByDrugList.html?projId=${param.projId}",
			mtype: "POST",
	        datatype:'json',
	        postData:{"drugCode":drugCode, "qualityspecName":qualityspecName,"compName":compName},
	        page : 1
	    }).trigger("reloadGrid"); //重新载入  
	}
        $(function () {
            $("#gridlist").jqGrid({
                url: "${ctx}/bidProject/getAuditDrugCompprofileByDrugList.html?projId=${param.projId}",
                mtype: "POST",
                datatype: "json",
                autowidth: true,
                //shrinkToFit:false,
                height: 270,
                colNames: ['projProddrugId','prodId','药品编码','品规编号', '品规名','通用名','规格','企业名称','审核状态','澄清状态'/* ,'操作' */],
                colModel: [
					
					{ name: 'projProddrugId', width: 100,hidden:true , align:"center" ,sortable: false},
					{ name: 'prodId', width: 100,hidden:true , align:"center" ,sortable: false},
					{ name: 'drugCode', width: 100 , align:"center" ,sortable: false},
                    { name: 'qualityspecCode', width: 100 , align:"center",sortable: false},
                    { name: 'qualityspecName', width: 100 , align:"center" ,sortable: false},
                    { name: 'formName', width: 100 , align:"center" ,sortable: false},
                    { name: 'specName', width: 140 , align:"center" ,sortable: false},
                    { name: 'compName', width: 160 , align:"center" ,sortable: false},
                    { name: 'auditStatus', width: 100 ,hidden:false, align:"center" ,sortable: false,
					formatter:function(val, opts, rowdata){
							var str="";
							if(val=="1"){
							return str="通过";
							}else if(val=="2"){
							return str="不通过";
							}
							return str;
					}},
					{ name: 'complainStatus', width: 100 ,hidden:false, align:"center" ,sortable: false,
					formatter:function(val, opts, rowdata){
							var str="";
							if(val=="1"){
							return str="通过";
							}else if(val=="2"){
							return str="不通过";
							}
							return str;
					}},
                    /* { name: 'operate', width: 140,sortable: false, align:"center",
                    	formatter : function(val, opts, rowdata) {
                    		var str = "";
                    		str += "<a href='${ctx}/bidProject/toAuditDrugCompprofileAudit.html?projId=${param.projId}&projProddrugId="+rowdata.projProddrugId+"' >申报审核</a>";
                    		str += "<a href='${ctx}/bidProject/toAuditDrugCompprofileDetailAudit.html?projId=${param.projId}&projProddrugId="+rowdata.projProddrugId+"' >申报澄清审核</a>";
                    		return str;
                    	}	 } */
					
                ],
                
                rowNum: 20,
                rowList: [10, 20, 50, 100],
                rownumbers: true,
                pager: "#gridpage",
                multiselect: true, 
                viewrecords: true,
                caption: "按药品审核药品资质",
                jsonReader: {
                    repeatitems: false,
                    id: "qualityspecId"
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
        });

        //通过
        function batchChangeStatus(auditStatus) {
        	var rowIds = $("#gridlist").jqGrid("getGridParam", "selarrrow") || [];
    		if (rowIds.length <= 0) {
    			$.HN.message.alert("请选择要操作的行！", "消息", "error");
    			return;
    		}
            $.HN.message.confirm("确定通过吗？", '', '').on(function (e) {
       		 if(e){
            var list = [];
            for (var i=0; i<rowIds.length; i++) {
           	 var rowdata = $("#gridlist").jqGrid(
							'getRowData', rowIds[i]);
                list.push({ "projProddrugId":rowdata.projProddrugId,"auditStatus":1});
            }
            $.post("${ctx}/bidProject/auditDrug.html", {
                "array" : json.jsonToString(list),"auditStatus":1
            }, function(result) {
                if (result.success) {
                    $.HN.message.alert("操作成功！", "消息", "success");
                    document.location.href="${ctx}/bidProject/toAuditDrugCompprofileByDrugList.html?projId=${param.projId}";
                } else {
                    $.HN.message.alert("操作失败！", "消息", "error");
                }
            }, "json")
		      }
				 
			 });
        }
        //不通过
        function batchChangeStatusNot(auditStatus) {
        	var rowIds = $("#gridlist").jqGrid("getGridParam", "selarrrow") || [];
    		if (rowIds.length <= 0) {
    			$.HN.message.alert("请选择要操作的行！", "消息", "error");
    			return;
    		}
            $.HN.message.confirm("确定不通过吗？", '', '').on(function (e) {
       		 if(e){
            var list = [];
            for (var i=0; i<rowIds.length; i++) {
           	 var rowdata = $("#gridlist").jqGrid(
							'getRowData', rowIds[i]);
                list.push({ "projProddrugId":rowdata.projProddrugId,"auditStatus":2});
            }
            $.post("${ctx}/bidProject/auditDrug.html", {
                "array" : json.jsonToString(list),"auditStatus":2
            }, function(result) {
                if (result.success) {
                    $.HN.message.alert("操作成功！", "消息", "success");
                    document.location.href="${ctx}/bidProject/toAuditDrugCompprofileByDrugList.html?projId=${param.projId}";
                } else {
                    $.HN.message.alert("操作失败！", "消息", "error");
                }
            }, "json")
		      }
				 
			 });
        }
        //澄清通过
        function batchChangeStatusAudit(complainStatus) {
        	var rowIds = $("#gridlist").jqGrid("getGridParam", "selarrrow") || [];
    		if (rowIds.length <= 0) {
    			$.HN.message.alert("请选择要操作的行！", "消息", "error");
    			return;
    		}
            $.HN.message.confirm("确定通过吗？", '', '').on(function (e) {
       		 if(e){
            var list = [];
            for (var i=0; i<rowIds.length; i++) {
           	 var rowdata = $("#gridlist").jqGrid(
							'getRowData', rowIds[i]);
                list.push({ "projProddrugId":rowdata.projProddrugId,"complainStatus":1});
            }
            $.post("${ctx}/bidProject/auditComplainDrug.html", {
                "array" : json.jsonToString(list),"complainStatus":1
            }, function(result) {
                if (result.success) {
                    $.HN.message.alert("操作成功！", "消息", "success");
                    document.location.href="${ctx}/bidProject/toAuditDrugCompprofileByDrugList.html?projId=${param.projId}";
                } else {
                    $.HN.message.alert("操作失败！", "消息", "error");
                }
            }, "json")
		      }
				 
			 });
        }
        //澄清不通过
        function batchChangeStatusAuditNot(complainStatus) {
        	var rowIds = $("#gridlist").jqGrid("getGridParam", "selarrrow") || [];
    		if (rowIds.length <= 0) {
    			$.HN.message.alert("请选择要操作的行！", "消息", "error");
    			return;
    		}
            $.HN.message.confirm("确定不通过吗？", '', '').on(function (e) {
       		 if(e){
            var list = [];
            for (var i=0; i<rowIds.length; i++) {
           	 var rowdata = $("#gridlist").jqGrid(
							'getRowData', rowIds[i]);
                list.push({ "projProddrugId":rowdata.projProddrugId,"complainStatus":2});
            }
            $.post("${ctx}/bidProject/auditComplainDrug.html", {
                "array" : json.jsonToString(list),"complainStatus":2
            }, function(result) {
                if (result.success) {
                    $.HN.message.alert("操作成功！", "消息", "success");
                    document.location.href="${ctx}/bidProject/toAuditDrugCompprofileByDrugList.html?projId=${param.projId}";
                } else {
                    $.HN.message.alert("操作失败！", "消息", "error");
                }
            }, "json")
		      }
				 
			 });
        }
        
        
     
    </script>
</body>
</html>